package com.its.test.testdemo.disruptor;

import com.its.common.disruptor.consumer.BaseMessageConsumer;
import com.its.common.disruptor.dto.TranslatorData;
import com.its.common.disruptor.dto.TranslatorDataWapper;
import lombok.extern.slf4j.Slf4j;

import java.util.Arrays;

/**
 * @Author xiaxp
 * @Date 2021-11-25 16:34
 * @Description
 */
@Slf4j
public class MessageConsumerImpl extends BaseMessageConsumer {

	public MessageConsumerImpl(String consumerId) {
		super(consumerId);
	}

	@Override
	public void handleData(TranslatorDataWapper translatorDataWapper) {
		TranslatorData request = translatorDataWapper.getData();
		//业务处理逻辑: 数据库持久化操作 IO读写 ---> 交给一个线程池 去异步的调用执行
		log.info(Thread.currentThread().getId()
				+"--- 消费者端: id= " + request.getId());

		Arrays.toString(request.getMessage());
	}

}
